<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>编辑用户</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-color: #f4f4f9;
            margin: 0;
        }

        h1 {
            color: #333;
            text-align: center;
            margin-bottom: 20px;
        }

        form {
            background-color: #fff;
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            width: 400px;
            margin: 0 auto;
            margin-top: 20px;
        }

        p {
            margin-bottom: 15px;
        }

        label {
            color: #666;
        }

        input[type="text"] {
            width: 100%;
            margin-top: 10px;
            padding: 8px;
            box-sizing: border-box;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        input[type="checkbox"] {
            margin-right: 5px;
        }

        .checkbox-container {
            display: flex;
            align-items: center;
        }

        input[type="submit"] {
            background-color: #007BFF;
            color: #fff;
            padding: 10px 20px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.3s ease;
            display: block;
            margin: 20px auto 0;
        }

        input[type="submit"]:hover {
            background-color: #0056b3;
        }

        span[style="color: red;"] {
            display: block;
            margin-top: 5px;
            font-size: 0.9em;
        }
    </style>
</head>
<body>
    <h1>编辑用户</h1>
    <form id="editUserForm" method="post" action="{{ url_for('edit_user', user_id=user.id if user else 0) }}">
        {{ form.hidden_tag() }}
        <p>
            {{ form.username.label }}<br>
            {{ form.username(size=32) }}
            {% for error in form.username.errors %}
            <span style="color: red;">[{{ error }}]</span>
            {% endfor %}
        </p>
        <p class="checkbox-container">
            {{ form.is_disable() }}
            {{ form.is_disable.label }}
        </p>
        <p class="checkbox-container">
            {{ form.is_admin() }}
            {{ form.is_admin.label }}
        </p>
        <p><input type="button" value="提交" onclick="submitForm()"></p>
    </form>
</body>
</html>